<template>
	<view>
		<cu-custom bgColor="bg-white" :isBack="true">
			<block slot="backText"></block>
			<block slot="content">礼品赠送</block>
		</cu-custom>
		<view class="bg02" style="background-image:url('/static/images/bg04.png')">
			<view class="tc">
				<view class="fs38 fw600 text-white" v-text="pageSour.StatusName"></view>
				<view class="fs24 text-white">请耐心等待</view>
			</view>
			<view class="qui-cells qui-card">
				<view class="qui-cell">
					<view class="cell-hd"><image :src="imgurl+pageSour.Giftimage" class="img84"></image></view>
					<view class="cell-bd fs28 mr30" v-text="pageSour.GiftName"></view>
					<view class="cell-ft tr">
						<view class="fs34 ff text-black" v-text="`￥` + pageSour.GiftValue"></view>
						<view class="fs20 text-muted">礼品价值</view>
					</view>
				</view>
			</view>
			<view class="qui-cells qui-card">
				<view class="qui-cell border_none">
					<view class="cell-hd fs24 text-gray">收货人</view>
					<view class="cell-bd fs24 tr" v-text="pageSour.UserName"></view>
				</view>
				<view class="qui-cell border_none">
					<view class="cell-hd fs24 text-gray">手机号</view>
					<view class="cell-bd fs24 tr" v-text="pageSour.MobilePhone"></view>
				</view>
				<view class="qui-cell">
					<view class="cell-hd fs24 text-gray">收货地址</view>
					<view class="cell-bd fs24 tr" v-text="pageSour.Address"></view>
				</view>
				<view v-show="">
					<view class="qui-cell border_none">
						<view class="cell-hd fs24 text-gray">快递公司</view>
						<view class="cell-bd fs24 tr" v-text="pageSour.CourierCompany"></view>
					</view>
					<view class="qui-cell">
						<view class="cell-hd fs24 text-gray">快递单号</view>
						<view class="cell-bd fs24 tr" v-text="pageSour.CourierNumber"></view>
					</view>
				</view>
			</view>

			<view class="qui-cells qui-card">
				<view class="qui-cell">
					<view class="cell-bd">
						<view class="fs26 fw600">领奖须知</view>
						<view class="fs22 text-gray mt20">1、优惠券有使用期限限制，过了有效期不能使用；</view>
						<view class="fs22 text-gray">2、订单中包含特价商品时不能使用优惠券，优惠券不能与其他优惠（如促销活动）同时使用；</view>
						<view class="fs22 text-gray">3、优惠券只能抵扣订单金额，优惠金额超出订单金额部分不能再次使用，不能兑换现金；</view>
						<view class="fs22 text-gray">4、每个订单只能使用一张优惠券；</view>
						<view v-show="openbox">
							<view class="fs22 text-gray">2、订单中包含特价商品时不能使用优惠券，优惠券不能与其他优惠（如促销活动）同时使用；</view>
							<view class="fs22 text-gray">3、优惠券只能抵扣订单金额，优惠金额超出订单金额部分不能再次使用，不能兑换现金；</view>
							<view class="fs22 text-gray">4、每个订单只能使用一张优惠券；</view>
						</view>
						<view @tap="showbox" class="tc flex justify-center align-center mt30" style="background-color: #f6f6f6;">
							<view class="cell-ft fs20">展开全部</view>
							<view class="arrow-r"></view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import tools from 'utils/tools.js';
import base from 'utils/base.js';
export default {
	data() {
		return {
			openbox: false,
			imgurl: this.imgurl,
			good_img: uni.getStorageSync('goods_img'),
			pageSour: {},
			isDelivered: true
		};
	},
	mounted() {
		
	},
	methods: {
		showbox() {
			this.openbox = !this.openbox;
		},
		//主界面数据展示、列表切换条件 1红包 2积分 3实物
		lodingInitPage(options) {			
			uni.showLoading({
				title: '加载中',
				mask: true
			});

			var _this = this;
			//获取用户信息
			let globalData = getApp().globalData;
			let userInfo = globalData.UserInfo;
			//var requstData = {
			//	UserId: userInfo.UserID,
			//	//"ActivityPrizeType": 3,
			//	Id: options.Id || 0,
			//	ActivityId: options.ActivityId || 0,
			//	PageIndex: 0,
			//	PageSize: 100
			//};
            var requstData = {
                "OpenId": userInfo.OpenID,
                "ActivityPrizeType": 3,
                "ActivityPrizeHistoryId": options.Id || 0,
                "ActivityId": options.ActivityId || 0,
                "Lat":"",
                "Lng":""
            }
			let params = {
				hideLoading: true,
				type: 'POST',
                url: '/Activity/GiftExchangeServices',
				data: requstData,
				sCallback: function(response) {
					uni.hideLoading();
					if (response.Success) {
						var thisSour = response.Data;
						//if ((thisSour || []).length == 0) return false;
						//var item = thisSour[0];
                        var item = thisSour;
						if (item.GiftCategory == 1 && item.Status == 4) item.StatusName = '商家待发货';
						if (item.Status == 3) item.StatusName = '商家已发货';
						_this.pageSour = item;

						//显示快递公司
						if (item.GiftCategory == 1 && item.Status == 4)
							//商家待发货
							_this.isDelivered = false;
					} else {
						uni.showToast({
							icon: 'none',
							title: response.Msg
						});
					}
				}
			};
			base.ActivityRequest(params);
		}
	},
	onLoad(options) {
		let time = 0;
		let globalData = getApp().globalData;
		let current = this;
		let si = setInterval(function() {
			time = time + 1;
			if (globalData.ticket) {
				current.lodingInitPage(options);
				clearInterval(si);
			}
			if (time > 40) clearInterval(si);
		}, 200);
	}
};
</script>

<style lang="scss">
.bg02 {
	background-size: 100%;
	height: 250rpx;
	background-repeat: no-repeat;
	padding-top: 20rpx;
}

.img40 {
	width: 40rpx;
	height: 40rpx;
	position: relative;
	top: 9rpx;
	margin-right: 10rpx;
}

.img84 {
	width: 84rpx;
	height: 84rpx;
}
</style>
